import { http } from '@/utils/http'
import { post } from '@/utils/http'
import { packagedGetFileInfoResult } from '@/utils/upload-tool'

// 获取系统参数
export const getSysParams = (data: any) => {
  return http({
    method: 'POST',
    url: '/dict/getInfo',
    data,
  })
}
// 获取用户Permission
export const getUserPermission = () => {
  return http({
    method: 'POST',
    url: '/main/menus',
  })
}
// 获取单个文件
export const getFileSingle = (data: any) => {
  return new Promise((resolve, reject) => {
    http({
      method: 'POST',
      url: '/uploadFile/getFileInfo',
      data,
    })
      .then((res) => {
        packagedGetFileInfoResult(res)
        resolve(res)
      })
      .catch((err) => {
        reject(err)
      })
  })
}
// 获取文件
export const getFile = (data: any) => {
  return new Promise((resolve, reject) => {
    http({
      method: 'POST',
      url: '/uploadFile/getFileInfoList',
      data,
    })
      .then((res) => {
        packagedGetFileInfoResult(res)
        resolve(res)
      })
      .catch((err) => {
        reject(err)
      })
  })
}
// 获取当前登录信息
export const findUserInfo = (data: any) => {
  return http({
    method: 'POST',
    url: '/vmsLogin/findUserInfo',
    data,
  })
}
// 查询商户信息详情
export const getEnterpriseDetail = () => {
  return http({
    method: 'POST',
    url: '/enterprise/detail',
  })
}
// 请求版本
export const getVersion = () => {
  return http({
    method: 'POST',
    url: '/main/appLastVersion',
  })
}
// 查询首页信息
export const getIndexInfo = () => {
  return http({
    method: 'POST',
    url: '/main/indexInfo',
  })
}

// 获取操作日志
export const getBizOperateLogList = (data: any) => post({ url: '/V5/bizOperateLog/getList', data })

// 根据账单id获取二维码
export const getBillQrCode = (data: any) => post({ url: '/V5/thirdPaymentBill/detail', data })

// 获取支付结果
export const getPayResult = (data: any) => post({ url: '/pay/getPayResult', data })

// 查看收款码
export const getQrCode = (data: any) => post({ url: '/V5/thirdPaymentBill/queryScanCode', data })

// 取消收款
export const cancelPay = (data: any) => post({ url: '/V5/thirdPaymentBill/cancelPay', data })
